package com.lantosec.hmrp.modules.sysdata.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.sysdata.vo.SysDataProcessVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * <p>
 * 系统数据流程关联表 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-03-10
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysDataProcess extends BaseEntity<SysDataProcessVO> {

    private static final long serialVersionUID = 1L;
    public SysDataProcess(SysDataProcessVO vo){
        this.dataProcessId = vo.getDataProcessId();
        this.proInsId = vo.getProInsId();
        this.proInsName = vo.getProInsName();
        this.formTableId = vo.getFormTableId();
        this.dataId = vo.getDataId();
        this.dataSourceTableSchema = vo.getDataSourceTableSchema();
        this.dataSourceTableName = vo.getDataSourceTableName();
        this.currentTaskId = vo.getCurrentTaskId();
        this.createTime = vo.getCreateTime();
        this.finishTime = vo.getFinishTime();
    }

    @Override
    public SysDataProcessVO convertToVO(){
        return new SysDataProcessVO(this);
    }

    /**
     * 系统数据流程ID
     */
    @TableId(value = "data_process_id", type = IdType.ASSIGN_UUID)
    private String dataProcessId;

    /**
     * Flowable中对应的流程实例ID
     */
    private String proInsId;

    /**
     * Flowable中对应的流程实例名称
     */
    private String proInsName;

    /**
     * 流程的数据表单ID
     */
    private String formTableId;

    /**
     * 流程实例对应的数据表记录Id
     */
    private String dataId;

    /**
     * 流程实例对应的数据源表所在数据库
     */
    private String dataSourceTableSchema;

    /**
     * 流程实例对应的数据源表名
     */
    private String dataSourceTableName;

    /**
     * 当前任务节点Id
     */
    private String currentTaskId;

    /**
     * 当前任务节点Key
     */
    private String currentTaskKey;

    /**
     * 当前任务节点名称
     */
    private String currentTaskName;

    /**
     * 发起人Id
     */
    private String startUserId;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 完成时间
     */
    private Date finishTime;

    /**
     * 流程定义Id
     */
    private String processDefinitionId;

    /**
     * 流程部署Id
     */
    private String processDeploymentId;

    /**
     * 流程状态 完成 FINISH。进行中 PROCESSING，关闭 CLOSE
     */
    private String processStatus;

    /**
     * 流程分类Id，字典表
     */
    private String processTypeId;

    /**
     * 发起人
     */
    @TableField(exist = false)
    private String userName;


    public enum ColName {
        data_process_id, pro_ins_id, pro_ins_name, form_table_id, data_id, data_source_table_schema, data_source_table_name,process_type_id
        ,current_task_id, create_time, finish_time,start_user_id,current_task_key,current_task_name,process_definition_id,process_status,process_deployment_id
    }
}
